﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Bas1b20
    {
		private string _sellerid;
		private string _shopid;
		private string _usercode;
		private string _tmp3;
		private string _tmp1;
		private string _tmp2;
		
        /// <summary>
        /// 销售商
        /// </summary>
		public string Sellerid
		{
			get { return _sellerid;	 }
			set { _sellerid=value;	}
		}
        /// <summary>
        /// 门店
        /// </summary>
		public string Shopid
		{
			get { return _shopid;	 }
			set { _shopid=value;	}
		}
        /// <summary>
        /// 用户
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 备用字段3
        /// </summary>
		public string Tmp3
		{
			get { return _tmp3;	 }
			set { _tmp3=value;	}
		}
        /// <summary>
        /// 备用字段
        /// </summary>
		public string Tmp1
		{
			get { return _tmp1;	 }
			set { _tmp1=value;	}
		}
        /// <summary>
        /// 备用字段2
        /// </summary>
		public string Tmp2
		{
			get { return _tmp2;	 }
			set { _tmp2=value;	}
		}
		
		public static List<Bas1b20> GetBas1b20ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Bas1b20> list = new List<Bas1b20>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Bas1b20 model = GetBas1b20ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Bas1b20 GetBas1b20ByDataRow(DataRow dr)
		{
			Bas1b20 model = new Bas1b20(); //实例化Bas1b20
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("sellerid")&&!(dr["sellerid"] is System.DBNull))  
				model.Sellerid = ( string)dr["sellerid"];
			if (dcc.Contains("shopid")&&!(dr["shopid"] is System.DBNull))  
				model.Shopid = ( string)dr["shopid"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("tmp3")&&!(dr["tmp3"] is System.DBNull))  
				model.Tmp3 = ( string)dr["tmp3"];
			if (dcc.Contains("tmp1")&&!(dr["tmp1"] is System.DBNull))  
				model.Tmp1 = ( string)dr["tmp1"];
			if (dcc.Contains("tmp2")&&!(dr["tmp2"] is System.DBNull))  
				model.Tmp2 = ( string)dr["tmp2"];
			
			return model;
		}
    }
}
